package site.xiaodi.proxy.cglib;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import site.xiaodi.proxy.GamePlayer;

import java.lang.reflect.Method;

/**
 * @author xiao
 * @email 245938767@qq.com
 * @gitee https://gitee.com/liu_yong_qiee/
 * @date 2021/10/6 9:51 上午
 */
public class GamePlayerProxycglib implements MethodInterceptor {

    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("before " + method.getName());
        methodProxy.invokeSuper(o, objects);
        System.out.println("after " + method.getName());
        return null;
    }
}
